Skip to content

Feature: a system is an AbstractTrees tree, children(system) - #235

Merged
StackEnjoyer merged 2 commits into
feature/coincident-hitsfrom
internal/children-of-system
Nov 8, 2026
Merged

StackEnjoyer merged 2 commits into
feature/coincident-hitsfrom
internal/children-of-system

Conversation

@StackEnjoyer

Copy link
Copy Markdown
Owner

Features

  • AbstractTrees.children(system): top-level objects and groups as added, groups not flattened
  • A System prints as one tree with a System root, like print_tree(system)
using AbstractTrees
system = System([ObjectGroup([m1, m2]), det])
children(system)    # [group, det]
Leaves(system)      # m1, m2, det

Bugfixes

  • show of a System or ObjectGroup printed to stdout instead of the given IO
  • render! of a custom system without an objects field threw a FieldError

Doc changes

  • Optical systems page: a system as an AbstractTrees tree; core.md solver diagram names children(system)
  • Agent skill: API.md updated

Internal changes

  • Solver, bounding spheres and live_render! read children(system); _top_level removed
  • Style: checked against AGENTS.md, no exceptions

Closes #234

uitt_hu and others added 2 commits November 7, 2026 23:53
A System returns its objects and groups as built, other systems
objects(system). A System and an ObjectGroup print as one tree into the
given IO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ield (review r1 F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.52%. Comparing base (1bf6301) to head (3a907a3).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           feature/coincident-hits     #235      +/-   ##
===========================================================
+ Coverage                    92.39%   92.52%   +0.13%     
===========================================================
  Files                           85       85              
  Lines                         4510     4509       -1     
===========================================================
+ Hits                          4167     4172       +5     
+ Misses                         343      337       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@StackEnjoyer
StackEnjoyer merged commit 951b946 into feature/coincident-hits Nov 8, 2026
6 of 7 checks passed
StackEnjoyer added a commit that referenced this pull request Nov 8, 2026
* Test: coincident-boundary matrix for cemented lenses, beamsplitters and touching bodies (#167)

* Feature: coincident hits of touching surfaces, the hint only speeds up the trace (#167)

trace_all and trace_one collect all surfaces that a ray hits within
get_coincidence_tolerance() (1 nm) of the closest hit as a chain of
coincident hits. Objects whose bounding sphere lies beyond the closest hit
are not tested. The hinted object is tested first, but its hit no longer
wins over a closer one: among coincident hits, the hinted shape comes
first. Parts of doublets and cube beamsplitters that are moved apart now
show the air gap.

* Bugfix: coincident hits without a shape are kept (#177)

The shape of an Intersection is optional. Hits of objects with an own
intersect3d that leave it empty were taken for duplicates of each other,
such that only one of them stayed in the chain of coincident hits. Hits
without a shape are now always kept; duplicates no longer arise, since the
hinted object is not tested twice.

* Internal: hit chains with one default tolerance, first_of shared by the hint order

* Docs: core diagrams show coincident hits, the beyond-skip and the hint as an optimization

* Style: argument names and label comments (AGENTS.md N1, C1)

* Style: argument name in first_of_shape (N1)

* Test: constant refractive indices as ConstantRefractiveIndex after #213

* Test: constant refractive indices as ConstantRefractiveIndex after #213

* Test: coincident boundaries read internals through one adapter, near-contact cases

- All access to BMO internals of TestCoincidentBoundaries.jl in one adapter block; the tests use
  exported names, AbstractTrees.children and the coating getter, no component or beamlet fields
- Beamlet split checked through the physical on-axis field for both models, with the documented
  Fresnel loss of the astigmatic beamlet at the uncoated back face of the plate
- Separate touching plates with gaps and overlaps far below and far above the coincidence
  tolerance, and rotated and moved together
- Benchmark adds the 50 lenses off the beam path (same code as #177)
- Leftover lines removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test: thin splitter between plates checked ray by ray, no representation checks

- The branches of the thin beamsplitter between touching plates are compared with the reference
  trace in position, direction and index of every ray (ray_error, shared with path_error)
- Equal-glass doublet and triplet compared with the singlet by the sequence of media, not by the
  number of rays; the owner of a hit on coincident faces is no longer fixed
- Benchmark name column wide enough for the crowded rows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test: touching objects are one interface, stated as the target of the matrix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test: touching plates carry the Fresnel loss of one glass-glass interface

- Polarized ray through touching plates at normal incidence: the flux n |E|² behind them is the
  Fresnel chain with one glass-glass step, none for equal glass; with a 1 µm gap two glass-air
  faces. @test_broken on master, passing with #178
- Fresnel transmission at normal incidence and the flux of a polarized ray as shared helpers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Bugfix: hinted objects in groups tested once, skip applies within groups (#177 review)

- closest_hits descends into object groups, so the hinted object is
  skipped there too and the members beyond the closest hit are not tested
- Contract: the bounding sphere of an object encloses every hit of its
  intersect3d, also of a method of its own; an object whose hits leave its
  shape returns NoBoundingSphere() (AbstractObject, bounding_sphere_of,
  AGENTS.md extension promise); tests for both object orders
- Hint and tracing_step! docstrings: the hint only orders the tests
- get_coincidence_tolerance: relation to the SDF surface threshold
- Style: isbeyond, is_in_chain (N1); typed skip and target (D1)
- Core diagram of trace_all shows closest_hits, skip and groups

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Bugfix: trace_all inferred again, skipped object boxed once, sphere tested once (#177 review r2)

- Type assertion on the recursive closest_hits call; @nospecialize skip, since an
  immutable hinted object was boxed again for every part
- Sphere pretest in the loop only once a hit is found; a group tests its sphere
  without a hit, an object leaves it to intersect3d
- Comments on groups describe the current path; core.md diagram updated
- Test: trace_all and trace_one inferred for System, grouped System and
  StaticSystem; allocations do not grow with the number of parts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Internal: group sphere test of closest_hits split into two statements, signatures reformatted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Docs: core.md diagrams of the solver as plain yes/no flows, trace_all split into search and object hit, order of coincident hits stated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Feature: a system is an AbstractTrees tree, children(system) (#235)

* Internal: AbstractTrees.children(system) replaces _top_level (#234)

A System returns its objects and groups as built, other systems
objects(system). A System and an ObjectGroup print as one tree into the
given IO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Bugfix: render! of a system reads children(system), not the objects field (review r1 F1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: uitt_hu <hugo.uittenbosch@dlr.de>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: uitt_hu <hugo.uittenbosch@dlr.de>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: StackEnjoyer <93778924+StackEnjoyer@users.noreply.github.com>
@StackEnjoyer
StackEnjoyer deleted the internal/children-of-system branch November 8, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant